from mpi4py import MPI
import numpy as np
comm = MPI.COMM_WORLD
rank = comm.Get_rank()

randNum = np.zeros(1)
if rank == 0:
    randNum = np.random.random_sample(1)
    print(f"Process {rank} draw the number {randNum[0]}")
    comm.Send(randNum, dest=1)
if rank == 1:
    print(f"Process {rank} before receiving has the number {randNum[0]}")
    comm.Recv(randNum, source=0)
    print(f"Process {rank} received the number {randNum[0]}")
